package tools;

import java.io.Serializable;

import adaptors.TabReference;





/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class Tab implements Serializable	{	

	private static final long serialVersionUID = 1L;
	private String address;
	private String tabText;
	private String bandName;
	private String songName;
	private String rating;
	private String numRated;
	private String tabType;
	
	public Tab(String bandName, String songName, String url, String rating, String numRated, String tabType)	{
		this.bandName = bandName;
		this.songName = songName;
		this.address = url;
		this.rating = rating;
		this.numRated = numRated;
		this.tabType = tabType;
	}

	public String getAddress() {
		return address;
	}

	public String getTabText() {
		return tabText;
	}

	public void setTabText(String tt)	{
		tabText = tt;
	}
	
	public String getBandName() {
		return bandName;
	}

	public String getSongName() {
		return songName;
	}

	public String getRating() {
		String nrating = "";
		char c = 248;
		
		if( rating.equals("r_1") )	{
			nrating = "" + c;
		}
		else if( rating.equals("r_2") )	{
			nrating = "" + c + c;
		}
		else if( rating.equals("r_3") )	{
			nrating = "" + c + c + c;
		}
		else if( rating.equals("r_4") )	{
			nrating = "" + c + c + c + c;
		}
		else if( rating.equals("r_5") )	{
			nrating = "" + c + c + c + c + c;
		}
				
		return nrating;
	}

	public String getNumRated() {
		return numRated;
	}

	public String getTabType() {
		return tabType;
	}
	
	public String toString()	{
		return songName + " R:" + rating + " (" + numRated + ")";
	}
	
	public String getFilePath()	{
		return bandName+"/"+songName+TabIO.TAB_FILE_EXTENSION;
	}
		
	public void getTab()	{
		tabText = TabIO.getTab(address);
	}
	
	public TabReference getReference()	{
		return new TabReference(bandName, songName, rating, numRated, getFilePath());
	}

	public void setBandName(String text) {
		bandName = text;
	}

	public void setSongName(String text) {
		songName = text;
	}

	public void setTabType(String text) {
		tabType = text;
	}

	public void setRating(String text) {
		rating = text;
	}
	
	public void setNumRated(String text) {
		numRated = text;
	}
}
